#include<iostream>
#include<map>

using namespace std;
const int N = 100010;

char stk1[N];//stk1装符号
long long stk2[N], tt1, tt2;//stk2装数
map<char, int> h{ {'+', 1}, {'-', 1}, {'*',2}, {'/', 2} };

//插入符号
void push1(char x){
    stk1[++ tt1] = x;
}
//插入数
void push2(int x){
    stk2[++ tt2] = x;
}
//删除符号
void pop1(){
    tt1 --;
}
//删除数
void pop2(){
    tt2 --;
}
//判断符号
bool empty1(){
    if(tt1 > 0) return false;
    return true;
}

int main(){
    string str;
    cin >> str;
    for(int i = 0; i < str.length();){
        if(str[i] == '('){
            push1(str[i]);
            i ++;
        }
        else if(str[i] >= '0' && str[i] <= '9'){
            int x = 0;
            while(str[i] >= '0' && str[i] <= '9'){
                x = x * 10 + str[i] - '0';
                i ++;
            }
            push2(x);
        }
        else if(str[i] == ')'){
            while(stk1[tt1] != '('){
                int x = stk2[tt2];
                pop2();
                int y = stk2[tt2];
                pop2();
                if(stk1[tt1] == '+') push2(x + y);
                else if(stk1[tt1] == '-') push2(y - x);
                else if(stk1[tt1] == '*') push2(x * y);
                else push2(y / x);
                pop1();
            }
            pop1();
            i ++;
        }
        else{
            while(!empty1() && h[stk1[tt1]] >= h[str[i]]){
                int x = stk2[tt2];
                pop2();
                int y = stk2[tt2];
                pop2();
                if(stk1[tt1] == '+') push2(x + y);
                else if(stk1[tt1] == '-') push2(y - x);
                else if(stk1[tt1] == '*') push2(x * y);
                else push2(y / x);
                pop1();
            }
            push1(str[i]);
            i ++;
        }
    }
    while(!empty1()){
        int x = stk2[tt2];
        pop2();
        int y = stk2[tt2];
        pop2();
        if(stk1[tt1] == '+') push2(x + y);
        else if(stk1[tt1] == '-') push2(y - x);
        else if(stk1[tt1] == '*') push2(x * y);
        else push2(y / x);
        pop1();
    }
    cout << stk2[tt2];
    return 0;
}